/*
 * Created on 26/06/2008
 */
package com.magicroot.gui.dreclamo;

import java.util.List;

import nextapp.echo.app.Extent;
import nextapp.echo.app.TextField;

import com.magicroot.model.DReclamo;
import com.magicroot.model._PropDReclamo;
import com.minotauro.echo.beans.EFieldLabel;
import com.minotauro.echo.beans.ETextAreaEx;
import com.minotauro.echo.cleda.edit.wrk.FrmEditWrk;
import com.minotauro.echo.cleda.list.var.EInnerButton;
import com.minotauro.echo.cleda.list.var.EJointButton;
import com.minotauro.echo.cleda.list.var.EJointModel;
import com.minotauro.echo.grid.FieldModel;
import com.minotauro.echo.grid.SectionModel;
import com.minotauro.echo.validator.impl.NotEmptyValidator;


/**
 * @author Demián Gutierrez
 */
public class FrmDReclamoEdit extends FrmEditWrk {

  protected FieldModel fmName;
  protected FieldModel fmDesc;
  protected FieldModel fmPhone;
  protected FieldModel fmNote;


  // --------------------------------------------------------------------------------

  public FrmDReclamoEdit() {
    super("ID", "test-net", "reclamo");
  }

  // --------------------------------------------------------------------------------

  protected void initGUI() {
    String name = ((DReclamo) data).getName();
    setTitle(_I18NFrmDReclamoEdit.title(name == null ? "-" : name));

    setW(new Extent(450));
    setH(new Extent(500));

    // --------------------------------------------------------------------------------

    SectionModel sectionModel = formModel.initSingleSectionModel();

    // --------------------------------------------------------------------------------

    TextField txtName = new TextField();
    txtName.setWidth(new Extent(204));

    fmName = new FieldModel();
    fmName.setLabelCmp(new EFieldLabel(_I18NFrmDReclamoEdit.name()));
    fmName.setFieldCmp(txtName);
    fmName.setKey(_PropDReclamo.NAME);
    fmName.setProperty(_PropDReclamo.NAME);

    fmName.getValidatorList().add( //
        new NotEmptyValidator(_I18NFrmDReclamoEdit.name(), txtName));

    sectionModel.addChild(fmName);

    // --------------------------------------------------------------------------------

    ETextAreaEx txtDesc = new ETextAreaEx();
    txtDesc.setWidth(new Extent(204));

    fmDesc = new FieldModel();
    fmDesc.setLabelCmp(new EFieldLabel(_I18NFrmDReclamoEdit.desc()));
    fmDesc.setFieldCmp(txtDesc);
    fmDesc.setKey(_PropDReclamo.DESC);
    fmDesc.setProperty(_PropDReclamo.DESC);

    fmDesc.getValidatorList().add( //
        new NotEmptyValidator(_I18NFrmDReclamoEdit.desc(), txtDesc));

    sectionModel.addChild(fmDesc);

    TextField txtphone = new TextField();
    
    fmPhone = new FieldModel();
    fmPhone.setLabelCmp(new EFieldLabel(_I18NFrmDReclamoEdit.phone()));
    fmPhone.setFieldCmp(txtphone);
    fmPhone.setKey(_PropDReclamo.PHONE);
    fmPhone.setProperty(_PropDReclamo.PHONE);
    
//    fmPhone.getValidatorList().add(new NotEmptyValidator(_I18NFrmDReclamoEdit.phone(), txtphone));
    
    sectionModel.addChild(fmPhone);
    
    TextField txtNote = new TextField();
    fmNote = new FieldModel();
    fmNote.setLabelCmp(new EFieldLabel(_I18NFrmDReclamoEdit.note()) );
    fmNote.setFieldCmp(txtNote);
    fmNote.setKey(_PropDReclamo.NOTE);
    fmNote.setProperty(_PropDReclamo.NOTE);
    
    sectionModel.addChild(fmNote);
    
    
    
  }

 



  

  // --------------------------------------------------------------------------------

  @Override
  protected DReclamo initMDocument() {
    return new DReclamo();
  }
}
